<template>
  <div class="swiper">
    <!-- 轮播图组件 -->
    <van-swipe class="my-swipe" :autoplay="1000" >
      <van-swipe-item v-for="(item,index) in bannerlist" :key="index">
        <img :src="item.bannerUrl" alt="">
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import {banner_list} from '../utils/api'

export default {
  data(){
    return{
      // swiperlist:[
      // {
      //     pic:"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F45bae90003a020b9ae5d58ce5a0145dab62bf52119513-vkgwQn_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1668758197&t=adc416473df8b18f85a7218b4e983ac1"
      //   },
      //   {
      //     pic:"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F45bae90003a020b9ae5d58ce5a0145dab62bf52119513-vkgwQn_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1668758197&t=adc416473df8b18f85a7218b4e983ac1"
      //   },
      //   {
      //     pic:"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F45bae90003a020b9ae5d58ce5a0145dab62bf52119513-vkgwQn_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1668758197&t=adc416473df8b18f85a7218b4e983ac1"
      //   },
      // ],
      bannerlist:[],
    }
  },
  mounted(){
    banner_list().then((res)=>{
      this.bannerlist = res.data.list;
      // console.log(this.bannerlist);
    })
  }
}
</script>

<style lang='scss' scoped>
.home{
  height: 300px;
  background-color: lightcoral;
}
.my-swipe img{
  width: 100%;
}
</style>